package com.burgeon.backend.SHOPBACKEND.controller;

import com.burgeon.backend.SHOPBACKEND.service.BackendLiveService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
@RequestMapping("backend/live")
public class BackendLiveController extends BaseController {
    @Autowired
    private BackendLiveService backendLiveService;

    @RequestMapping("batchData")
    public ResponseResult<Void> batchData(String[] ids, String account){
        System.err.println(ids);
        for (String id:ids){
            backendLiveService.andLiveGoods(id,account);
        }

        return new ResponseResult<>(SUCCESS);
    }


    @RequestMapping("andData")
    public ResponseResult<Void> andData(String id, String account){
        System.err.println(id);
        backendLiveService.andLiveGoods(id,account);

        return new ResponseResult<>(SUCCESS);
    }

    @RequestMapping("delData")
    public ResponseResult<Void> delData(String id, String account){
        System.err.println(id+account);
        backendLiveService.delLiveGoods(id,account);
        return new ResponseResult<>(SUCCESS);
    }
}
